Is the download URL permanent? - firebase-storage

Here's JS code I use to get the download URL:
ref.child('penus.jpg').getDownloadURL()
.then(url => {
console.log(url)
})
Is this url permanent? Can I share it?

The URL will work until you revoke the token that was assigned to it. You can do that in the Firebase console. Other than that, it's permanent and meant to be shared.

Related

How to track URL in flutter with website platform

I want to do oAuth2 verification in my website login page and after that I want to get token from url with same page but issue is i can`t able to get URL.
below URL is OAuth2 url using this url I am doing authentication steps with website using flutter.
1st this website will open in browser after that login page will open and after login i will get access_token. But i facing difficulties how i can get access_code with html.window.location function.
I have tried with this code
WidgetsBinding.instance!.addPostFrameCallback((_) {
html.window.location.assign(
'https://example/connect/authorize?response_type=token&client_id=$clientId&redirect_uri=https://example.app/silentRenew&scope=getinfo');
});
Anyone have better solution than please give suggestion.
Pinal! I did an oAuth2 flux recently consuming Gitlab API. I suggest you to use
the oauth2 plugin: oauth2. You just need to have the authorization endpoint, access token endpoint and the redirect url.
After this, you just need to call 3 methods.
Getting your AuthorizationCodeGrant.
var grant = oauth2.AuthorizationCodeGrant(identifier, authorizationEndpoint, tokenEndpoint,secret: secret)
Get Authorization Url.
var authorizationUrl = grant.getAuthorizationUrl(redirectUrl);
Get the returned Code.
await grant.handleAuthorizationResponse(responseUrl.queryParameters);
The method return your code automatically.
In my case, I used a webview instead opening the browser to listen the redirected url's. WebView
You just have to pass the authorizationUrl as the initial page flag inside webview, and listen to the url's with onPageStarted flag. So what you wanna do is: when the redirectUrl ,which gives you the code to authorize your access token, is accessed you call the method 3, only in this moment. I hope this help you, let me know if you struggle with something.

Is there a way to get a users Bitmoji using Access tokens from Snapkit login web api?

I am attempting to use the snapkit login web api for a hybrid application. I have successfully been able to intercept the access token in the redirectURL. I was wondering if there was a way to get the users Bitmoji using this access_token and either the functions found in login.js or an http get call?
Api docs: https://docs.snapchat.com/docs/login-kit/#web
currently I have the access_token in a deeplinking function on my app.component.ts . I have attempted to push to a new page with the navController and passing in the access_token as a parameter, but this doesn't help when attempting to get the users information.
Thanks in advance for your help.
Here is the Deeplinking where I intercept the access_token using myapp://settings-set/ as the URL redirect and attempt to push a new page with the matching url.
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
statusBar.styleDefault();
splashScreen.hide();
this.deeplinks.routeWithNavController(this.nav,{
'/settings-set/:token': SettingsSetPage
}).subscribe((match) => {
// match.$route - the route we matched, which is the matched entry from the arguments to route()
// match.$args - the args passed in the link
// match.$link - the full link data
this.nav.push(SettingsSetPage, {
args: match
});
console.log('Successfully matched route', match.$args);
},
(nomatch) => {
// nomatch.$link - the full link data
console.error('Got a deeplink that didn\'t match', nomatch);
});
});
}
In the setting-set page I recieve the parameter using:
this.args = navParams.get('args');
console.log("this is args", JSON.stringify(this.args));
but don't know how to use the information to get the users information
The Bitmoji API can be very confusing at times. I suggest using Passport, a Node JS tool for OAuth, along with the Ionic framework. Snapchat has a guide that explains how to grab specific fields, such as user name and Bitmoji avatar, from a user's Snapchat profile using passport. You can follow this tutorial to learn how to integrate Node JS into your existing ionic app.
So in conclusion, try following these steps:
Integrate Node JS into your existing ionic app
Install Passport and follow Snapchat's guide for obtaining specific fields from the user's profile
Yes, like Mora said you can use passport which will make your life easier. We also have a sample passport app running here:
From the context you provided it seems like you have generated the code and not the access_token. After you get the code from the redirect url, you need to use the code to generate the access token. Check section 2.5 here.
Once you have the access token you can use that to request information. The crux of this lies in setting the "scope" correctly. To get the Bitmoji avatar make sure you set your scope to this at the very least:
var scope = ['https://auth.snapchat.com/oauth2/api/user.bitmoji.avatar'];
Hope this helps!

Facebook API : Can I use public API(v2.x) without access token. (share count)

Facebook link share count API
https://graph.facebook.com/?id=http://stackoverflow.com <--- v1.0 (current.. available)
but
is this available after version 2.x? (without access token)
I want use this API
reference
https://developers.facebook.com/docs/graph-api/reference/v2.1/url
Nobody can look into the future, but I doubt facebook will disable that endpoint again so soon, because the "new version" was only introduced with v2.1.
The docs at https://developers.facebook.com/docs/graph-api/reference/v2.2/url state that an Access Token is required for the usage of this endpoint. This means you can also use an App Access Token, which is easy to get. Just create a new app at https://developers.facebook.com/apps/ and you're ready to go.
I have the same issue. And after some research I find this link https://developers.facebook.com/blog/post/2009/10/26/extending-facebook-share/ .
You can try use this approach, it work with any version FB API:
FB.api({
method: 'links.getStats',
urls: 'here you url'
}, function(response){
alert(response[0].total_count)
});
or https://api.facebook.com/restserver.php?&method=links.getStats&urls=http://stackoverflow.com&format=json-strings

Facebook profile pic URL redirect to different URL

I am using Faceboook API to login into my website through FB.
In this when I try to fetch the profile photo of the logged-in user through URL "http://graph.facebook.com/100003373201743/picture". Didn't get the response in code.
*id of user fetched from FB # run time.
Found the reason as well, coz defined URL redirects to "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-frc3/t1.0-1/p50x50/1975108_483512481771188_559759638979699650_s.jpg". I am not finding any link between these two URLs. So that I can directly hit to redirected one URL.
You can directly use the image url as "http://graph.facebook.com/100003373201743/picture", as #Tobi has mentioned
or,
if you want to fetch the actual url, you can get that in response of this-
http://graph.facebook.com/100003373201743/picture?redirect=0
You'll get the response as-
{
data: {
url: "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-frc3/t1.0-1/p50x50/1975108_483512481771188_559759638979699650_s.jpg",
is_silhouette: false
}
}
I found the solution of this problem.
Fetching headers of the URL "http://graph.facebook.com/100003373201743/picture".
Header named as "Location" have the value of redirected URL like "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-frc3/t1.0-1/p50x50/1975108_483512481771188_559759638979699650_s.jpg"
So hitting this URL and its working fine.

How to authenticate external web app to post to facebook app's page?

Has anyone been able to figure out how to authenticate an external web site to post to a facebook app's page (wall)?
We have an external rails site, and all I'm looking to do is post to our facebook app's page whenever a new resource is created. I'm so confused right now with all these tokens and expirations!!!
Ex. I can manually visit:
https://www.facebook.com/dialog/oauth?client_id=(our client id)&redirect_uri=(our redirect uri)&scope=manges_pages,publish_stream&response_type=token
(no parenthesis)
to get the account access token, but this approach is manual and it it works only if I go through my browser and I'm signed into FB (so it's using cookies). How can I automate the authenthientication process for my external web app?
I would try to use a Cross-Domain AJAX GET request to the URL (with parameters). This will allow the request to utilize the current user's cookies. jQuery is fairly reasonable for this type of situation. $.ajax(); using JSONP should do it.
Something like this:
$.ajax({
type: 'GET',
url: 'https://www.facebook.com/dialog/oauth',
data: {
client_id: '(our client id)',
redirect_uri: '(our redirect uri)',
scope: 'manges_pages',
publish_stream: '',
response_type: 'token',
format: 'jsonp'
},
dataType: 'jsonp',
success: function(data)
{
// Do stuff.
}
});
EDIT:
Should be noted that I haven't ever done this with Facebook's API specifically. In doing a little digging, I don't know if this is possible to do with just a GET request:
https://developers.facebook.com/docs/reference/api/
Seems you need some kind of authentication to happen on the server-side before you can publish to their API.