Compare commits
2 Commits
564a18ea28
...
f863a918bf
Author | SHA1 | Date | |
---|---|---|---|
f863a918bf | |||
56345d9933 |
30
bruno/OpenData datatourisme/Google API.bru
Normal file
30
bruno/OpenData datatourisme/Google API.bru
Normal file
@ -0,0 +1,30 @@
|
||||
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,3 +1,4 @@
|
||||
vars:secret [
|
||||
app_key
|
||||
app_key,
|
||||
GOOGLE_API_KEY
|
||||
]
|
||||
|
11
bruno/OpenData datatourisme/list oaut methode.bru
Normal file
11
bruno/OpenData datatourisme/list oaut methode.bru
Normal file
@ -0,0 +1,11 @@
|
||||
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
|
||||
}
|
18
bruno/OpenData datatourisme/oauth test.bru
Normal file
18
bruno/OpenData datatourisme/oauth test.bru
Normal file
@ -0,0 +1,18 @@
|
||||
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,6 +15,7 @@
|
||||
"@types/react": "^18.2.79",
|
||||
"@types/react-dom": "^18.2.25",
|
||||
"astro": "4.5.12",
|
||||
"cross-fetch": "^4.0.0",
|
||||
"leaflet": "^1.9.4",
|
||||
"lucide-astro": "^0.372.0",
|
||||
"pocketbase": "^0.21.1",
|
||||
@ -3340,6 +3341,14 @@
|
||||
"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": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
@ -7178,6 +7187,25 @@
|
||||
"integrity": "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==",
|
||||
"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": {
|
||||
"version": "2.0.14",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz",
|
||||
@ -9869,6 +9897,11 @@
|
||||
"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": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz",
|
||||
@ -11088,6 +11121,20 @@
|
||||
"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": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
|
@ -19,6 +19,7 @@
|
||||
"@types/react": "^18.2.79",
|
||||
"@types/react-dom": "^18.2.25",
|
||||
"astro": "4.5.12",
|
||||
"cross-fetch": "^4.0.0",
|
||||
"leaflet": "^1.9.4",
|
||||
"lucide-astro": "^0.372.0",
|
||||
"pocketbase": "^0.21.1",
|
||||
|
@ -1,11 +1,11 @@
|
||||
---
|
||||
import Layout from 'layouts/Layout.astro';
|
||||
import AstroUtils from 'libs/AstroUtils';
|
||||
import PocketBase from 'pocketbase'
|
||||
|
||||
|
||||
const pb = Astro.locals.pb
|
||||
|
||||
const oauths = await pb.collection('users').listAuthMethods();
|
||||
|
||||
if(pb.authStore.isValid){
|
||||
return Astro.redirect("/account")
|
||||
}
|
||||
@ -51,20 +51,25 @@ await AstroUtils.wrap(async () => {
|
||||
<button>Créer un compte</button>
|
||||
</form>
|
||||
|
||||
<button id="OauthDiscord">connexion avec discord</button>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="type" value="discord2FA">
|
||||
<button id="OauthDiscord">connexion avec discord</button>
|
||||
</form>
|
||||
<a href={oauths.authProviders[1].authUrl + "https%3A%2F%2Fpb-tweb.cb85.fr%2Fapi%2Foauth2-redirect"}>discord?</a>
|
||||
</Layout>
|
||||
|
||||
<script>
|
||||
import PocketBase from 'pocketbase'
|
||||
const pb = Astro.locals.pb
|
||||
import 'cross-fetch/polyfill';
|
||||
import PocketBase from "pocketbase"
|
||||
import type { OAuth2UrlCallback } from "pocketbase"
|
||||
const pb = new PocketBase("https://pb-tweb.cb85.fr/")
|
||||
const discordBtn = document.querySelector<HTMLButtonElement>("#OauthDiscord")
|
||||
|
||||
if (discordBtn) {
|
||||
discordBtn.addEventListener('onclick', async () =>{
|
||||
await pb.collection('user').authWithOAuth2({provider: 'discord'})
|
||||
discordBtn.addEventListener('click', async () =>{
|
||||
const result = await pb.collection('users').listAuthMethods();
|
||||
fetch(result.authProviders[0].authUrl)
|
||||
console.log(result);
|
||||
})
|
||||
}
|
||||
</script>
|
Loading…
x
Reference in New Issue
Block a user