Skip to content

Instantly share code, notes, and snippets.

@chuyihuang
Created August 26, 2016 09:13
Show Gist options
  • Save chuyihuang/d74503ac9c2186b7f8515478b56bd99a to your computer and use it in GitHub Desktop.
Save chuyihuang/d74503ac9c2186b7f8515478b56bd99a to your computer and use it in GitHub Desktop.
invalid_auth when connecting to eventbrite
// https://www.eventbriteapi.com/v3/users/me/?token=SESXYS4X3FJ5LHZRWGKQ
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet
} from 'react-native';
const API_KEY = 'Bearer SESXYS4X3FJ5LHZRWGKQ';
const ROOT_URL = 'https://www.eventbriteapi.com/v3/events/search/';
export default class Main extends Component {
componentDidMount() {
this.searchEvents('hackathon', 'San Francisco')
}
searchEvents(category, city) {
const FETCH_URL = `${ROOT_URL}?q=${category}&venue.city=${city}/`;
fetch(FETCH_URL, {
method: 'GET',
headers: {
'Authorization': API_KEY
}
})
.then((res) => res.json())
.then((res) => {
console.log(res);
})
}
render() {
return (
<View style={styles.container}>
<Text>
Event Expert
</Text>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment