Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve cookie issues in Instragram & LinkedIn samples #849

Merged
merged 1 commit into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion instagram-auth/firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
"rules": "database.rules.json"
},
"hosting": {
"public": "public"
"public": "public",
"rewrites": [
{
"source": "/redirect",
"function": "redirect"
},
{
"source": "/token",
"function": "token"
}
]
}
}
4 changes: 2 additions & 2 deletions instagram-auth/public/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@
document.body.innerText = 'Error back from the Instagram auth page: ' + error;
} else if(!code) {
// Start the auth flow.
window.location.href = 'https://us-central1-' + getFirebaseProjectId() + '.cloudfunctions.net/redirect';
window.location.href = '/redirect';
} else {
// Use JSONP to load the 'token' Firebase Function to exchange the auth code against a Firebase custom token.
const script = document.createElement('script');
script.type = 'text/javascript';
// This is the URL to the HTTP triggered 'token' Firebase Function.
// See https://firebase.google.com/docs/functions.
var tokenFunctionURL = 'https://us-central1-' + getFirebaseProjectId() + '.cloudfunctions.net/token';
var tokenFunctionURL = '/token';
script.src = tokenFunctionURL +
'?code=' + encodeURIComponent(code) +
'&state=' + encodeURIComponent(state) +
Expand Down
12 changes: 11 additions & 1 deletion linkedin-auth/firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
"rules": "database.rules.json"
},
"hosting": {
"public": "public"
"public": "public",
"rewrites": [
{
"source": "/redirect",
"function": "redirect"
},
{
"source": "/token",
"function": "token"
}
]
}
}
4 changes: 2 additions & 2 deletions linkedin-auth/public/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@
document.body.innerText = 'Error back from the LinkedIn auth page: ' + error;
} else if(!code) {
// Start the auth flow.
window.location.href = 'https://us-central1-' + getFirebaseProjectId() + '.cloudfunctions.net/redirect';
window.location.href = '/redirect';
} else {
// Use JSONP to load the 'token' Firebase Function to exchange the auth code against a Firebase custom token.
const script = document.createElement('script');
script.type = 'text/javascript';
// This is the URL to the HTTP triggered 'token' Firebase Function.
// See https://firebase.google.com/docs/functions.
var tokenFunctionURL = 'https://us-central1-' + getFirebaseProjectId() + '.cloudfunctions.net/token';
var tokenFunctionURL = '/token';
script.src = tokenFunctionURL +
'?code=' + encodeURIComponent(code) +
'&state=' + encodeURIComponent(state) +
Expand Down