Compare commits
No commits in common. "f863a918bfd1bc295fc09889513a968aaab10bec" and "564a18ea28160359f7a38027c1076ea0d7c82946" have entirely different histories.
f863a918bf
...
564a18ea28
@ -1,30 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: Google API
|
|
||||||
type: http
|
|
||||||
seq: 3
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
url: https://places.googleapis.com/v1/places:searchNearby
|
|
||||||
body: json
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
|
|
||||||
headers {
|
|
||||||
X-Goog-Api-Key: {{GOOGLE_API_KEY}}
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"includedTypes": ["restaurant"],
|
|
||||||
"maxResultCount": 10,
|
|
||||||
"locationRestriction": {
|
|
||||||
"circle": {
|
|
||||||
"center": {
|
|
||||||
"latitude": 37.7937,
|
|
||||||
"longitude": -122.3965},
|
|
||||||
"radius": 500.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,3 @@
|
|||||||
vars:secret [
|
vars:secret [
|
||||||
app_key,
|
app_key
|
||||||
GOOGLE_API_KEY
|
|
||||||
]
|
]
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: list oaut methode
|
|
||||||
type: http
|
|
||||||
seq: 5
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: https://pb-tweb.cb85.fr/api/collections/users/auth-methods
|
|
||||||
body: none
|
|
||||||
auth: none
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: oauth test
|
|
||||||
type: http
|
|
||||||
seq: 4
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
url: https://pb-tweb.cb85.fr/api/collections/users/auth-with-oauth2
|
|
||||||
body: json
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
provider: "google"
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
47
front/package-lock.json
generated
47
front/package-lock.json
generated
@ -15,7 +15,6 @@
|
|||||||
"@types/react": "^18.2.79",
|
"@types/react": "^18.2.79",
|
||||||
"@types/react-dom": "^18.2.25",
|
"@types/react-dom": "^18.2.25",
|
||||||
"astro": "4.5.12",
|
"astro": "4.5.12",
|
||||||
"cross-fetch": "^4.0.0",
|
|
||||||
"leaflet": "^1.9.4",
|
"leaflet": "^1.9.4",
|
||||||
"lucide-astro": "^0.372.0",
|
"lucide-astro": "^0.372.0",
|
||||||
"pocketbase": "^0.21.1",
|
"pocketbase": "^0.21.1",
|
||||||
@ -3341,14 +3340,6 @@
|
|||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/cross-fetch": {
|
|
||||||
"version": "4.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz",
|
|
||||||
"integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==",
|
|
||||||
"dependencies": {
|
|
||||||
"node-fetch": "^2.6.12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/cross-spawn": {
|
"node_modules/cross-spawn": {
|
||||||
"version": "7.0.3",
|
"version": "7.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||||
@ -7187,25 +7178,6 @@
|
|||||||
"integrity": "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==",
|
"integrity": "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==",
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"node_modules/node-fetch": {
|
|
||||||
"version": "2.7.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
|
||||||
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
|
||||||
"dependencies": {
|
|
||||||
"whatwg-url": "^5.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "4.x || >=6.0.0"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"encoding": "^0.1.0"
|
|
||||||
},
|
|
||||||
"peerDependenciesMeta": {
|
|
||||||
"encoding": {
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/node-releases": {
|
"node_modules/node-releases": {
|
||||||
"version": "2.0.14",
|
"version": "2.0.14",
|
||||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz",
|
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz",
|
||||||
@ -9897,11 +9869,6 @@
|
|||||||
"node": ">=0.6"
|
"node": ">=0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/tr46": {
|
|
||||||
"version": "0.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
|
||||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
|
|
||||||
},
|
|
||||||
"node_modules/trim-lines": {
|
"node_modules/trim-lines": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz",
|
||||||
@ -11121,20 +11088,6 @@
|
|||||||
"url": "https://github.com/sponsors/wooorm"
|
"url": "https://github.com/sponsors/wooorm"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/webidl-conversions": {
|
|
||||||
"version": "3.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
|
||||||
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
|
|
||||||
},
|
|
||||||
"node_modules/whatwg-url": {
|
|
||||||
"version": "5.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
|
||||||
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
|
||||||
"dependencies": {
|
|
||||||
"tr46": "~0.0.3",
|
|
||||||
"webidl-conversions": "^3.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/which": {
|
"node_modules/which": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
"@types/react": "^18.2.79",
|
"@types/react": "^18.2.79",
|
||||||
"@types/react-dom": "^18.2.25",
|
"@types/react-dom": "^18.2.25",
|
||||||
"astro": "4.5.12",
|
"astro": "4.5.12",
|
||||||
"cross-fetch": "^4.0.0",
|
|
||||||
"leaflet": "^1.9.4",
|
"leaflet": "^1.9.4",
|
||||||
"lucide-astro": "^0.372.0",
|
"lucide-astro": "^0.372.0",
|
||||||
"pocketbase": "^0.21.1",
|
"pocketbase": "^0.21.1",
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
---
|
---
|
||||||
import Layout from 'layouts/Layout.astro';
|
import Layout from 'layouts/Layout.astro';
|
||||||
import AstroUtils from 'libs/AstroUtils';
|
import AstroUtils from 'libs/AstroUtils';
|
||||||
|
import PocketBase from 'pocketbase'
|
||||||
|
|
||||||
|
|
||||||
const pb = Astro.locals.pb
|
const pb = Astro.locals.pb
|
||||||
|
|
||||||
const oauths = await pb.collection('users').listAuthMethods();
|
|
||||||
|
|
||||||
if(pb.authStore.isValid){
|
if(pb.authStore.isValid){
|
||||||
return Astro.redirect("/account")
|
return Astro.redirect("/account")
|
||||||
}
|
}
|
||||||
@ -51,25 +51,20 @@ await AstroUtils.wrap(async () => {
|
|||||||
<button>Créer un compte</button>
|
<button>Créer un compte</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<button id="OauthDiscord">connexion avec discord</button>
|
|
||||||
<form method="post" enctype="multipart/form-data">
|
<form method="post" enctype="multipart/form-data">
|
||||||
<input type="hidden" name="type" value="discord2FA">
|
<input type="hidden" name="type" value="discord2FA">
|
||||||
|
<button id="OauthDiscord">connexion avec discord</button>
|
||||||
</form>
|
</form>
|
||||||
<a href={oauths.authProviders[1].authUrl + "https%3A%2F%2Fpb-tweb.cb85.fr%2Fapi%2Foauth2-redirect"}>discord?</a>
|
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import 'cross-fetch/polyfill';
|
import PocketBase from 'pocketbase'
|
||||||
import PocketBase from "pocketbase"
|
const pb = Astro.locals.pb
|
||||||
import type { OAuth2UrlCallback } from "pocketbase"
|
|
||||||
const pb = new PocketBase("https://pb-tweb.cb85.fr/")
|
|
||||||
const discordBtn = document.querySelector<HTMLButtonElement>("#OauthDiscord")
|
const discordBtn = document.querySelector<HTMLButtonElement>("#OauthDiscord")
|
||||||
|
|
||||||
if (discordBtn) {
|
if (discordBtn) {
|
||||||
discordBtn.addEventListener('click', async () =>{
|
discordBtn.addEventListener('onclick', async () =>{
|
||||||
const result = await pb.collection('users').listAuthMethods();
|
await pb.collection('user').authWithOAuth2({provider: 'discord'})
|
||||||
fetch(result.authProviders[0].authUrl)
|
|
||||||
console.log(result);
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
Loading…
x
Reference in New Issue
Block a user